Using MUIA_Group_Spacing, you won't need to think if your group is horizontal or vertical, both cases are handled automatically.
Note that setting a spacing value for a group overrides the user's default settings. Please use it only if you have a good reason.